# create_vue_files.ps1
$template = @"
<script setup lang="ts">
import { useRoute } from "vue-router";
const route = useRoute();
</script>

<template>
  {{ route.query }}
</template>

<style scoped>
</style>
"@

# 定义要创建的目录和文件（包含所有路由对应的组件）
$files = @(
# 司机管理
    "driver/DriverInfo.vue",
    "driver/DriverAccount.vue",
    "driver/DriverDetail.vue",
    "driver/FaceRecognition.vue",
    "driver/LoginLog.vue",
    "driver/DriverSettings.vue",

    # 客户管理
    "customer/CustomerInfo.vue",
    "customer/LoginLog.vue",

    # 优惠券管理
    "coupon/CouponList.vue",
    "coupon/CouponDetail.vue",
    "coupon/CustomerCoupon.vue",

    # 订单管理
    "order/OrderList.vue",
    "order/OrderBill.vue",
    "order/OrderComments.vue",
    "order/OrderMonitor.vue",
    "order/OrderMonitorRecord.vue",
    "order/OrderProfitsharing.vue",
    "order/OrderStatusLog.vue",
    "order/OrderTrack.vue",
    "order/OrderJob.vue",

    # 规则管理
    "rule/CancelRule.vue",
    "rule/FeeRule.vue",
    "rule/ProfitsharingRule.vue",
    "rule/RewardRule.vue",

    # 支付管理
    "payment/PaymentInfo.vue",
    "payment/ProfitsharingInfo.vue",

    # 调度管理
    "dispatch/XxlJobLog.vue",

    # 系统配置
    "system/BasicConfig.vue",
    "system/PaymentConfig.vue",
    "system/MapConfig.vue",

    # 运营管理
    "operation/Notice.vue",
    "operation/Banner.vue",
    "operation/Activity.vue",

    # 客户服务
    "customer-service/Ticket.vue",
    "customer-service/Verify.vue",
    "customer-service/Feedback.vue",

    # 业务管理
    "business/Customer.vue",
    "business/Driver.vue",
    "business/Order.vue",
    "business/Dispatch.vue",
    "business/Payment.vue",
    "business/Coupon.vue"
)

# 创建所有必要的目录
$files | ForEach-Object {
    $dir = Split-Path -Path $_ -Parent
    if (!(Test-Path -Path $dir)) {
        New-Item -ItemType Directory -Path $dir -Force | Out-Null
    }
}

# 创建所有文件
$files | ForEach-Object {
    $template | Out-File -FilePath $_ -Encoding utf8
    Write-Host "已创建: $_"
}

Write-Host "✅ 所有 Vue 文件已成功创建！"